﻿using UnityEngine;
using Yoozoo.Gta.Common;

namespace Yoozoo.Gameplay.City
{
    public static class CityRealAiCSharpCallLuaManager
    {
        public static Vector3 GetAreaRandomPos(int key, int uid = 0, bool isSpecial = false)
        {
            return ResidentHandler.Inst.GetFunction("CityLuaFunction.getAreaRandomPos").Func<int, int, Vector3>(key, uid);
        }

        public static int GetBuildingLevel(int buildingId, int index = 1)
        {
            return ResidentHandler.Inst.GetFunction("CityLuaFunction.getBuildingLevel").Func<int, int, int>(buildingId, index);
        }

        public static int GetFacilityLevel(int buildingId, int facilityId)
        {
            return ResidentHandler.Inst.GetFunction("CityLuaFunction.getFacilityLevel").Func<int, int, int>(buildingId, facilityId);
        }

        public static bool IsRoofShow()
        {
            return ResidentHandler.Inst.GetFunction("CityLuaFunction.isRoofShow").Func<int, bool>(0);
        }
        
        public static void OpenAutoBusiness()
        {
            ResidentHandler.Inst.GetFunction("CityLuaFunction.openAutoBusiness").Action();
        }
        
        public static void CloseAutoBusiness()
        {
            ResidentHandler.Inst.GetFunction("CityLuaFunction.closeAutoBusiness").Action();
        }

        public static string RandomDialogueContent(int areaId)
        {
            return ResidentHandler.Inst.GetFunction("CityLuaFunction.randomDialogueContent").Func<int, string>(areaId);
        }
        
        public static string RandomAreaBossDialogueContent()
        {
            return ResidentHandler.Inst.GetFunction("CityLuaFunction.randomAreaBossDialogueContent").Func<int, string>(0);
        }

        public static float BindCommodityHUD(CityRealAiCommodityHUD hud)
        {
            return ResidentHandler.Inst.GetFunction("CityLuaFunction.bindCommodityHUD").Func<CityRealAiCommodityHUD, float>(hud);
        }
        
        public static void UnbindCommodityHUD(CityRealAiCommodityHUD hud)
        {
            ResidentHandler.Inst.GetFunction("CityLuaFunction.unbindCommodityHUD").Action(hud);
        }

        public static void OnSimulationClickCommodityHUD(GameObject button)
        {
            ResidentHandler.Inst.GetFunction("CityLuaFunction.onSimulationClickCommodityHUD").Action(button);
        }

        public static void ShowAutoCustomBubbles(int uid, Transform roleTrans, int buildingId)
        {
            ResidentHandler.Inst.GetFunction("CityLuaFunction.showAutoCustomBubbles").Action(uid, roleTrans, buildingId);
        }
        
        public static void ShowAutoDJBubbles(int uid, Transform roleTrans)
        {
            ResidentHandler.Inst.GetFunction("CityLuaFunction.showAutoDJBubbles").Action(uid, roleTrans);
        }
        
        public static void BindBabeMoodHUD(CityRealAiBabeMoodHUD hud)
        {
            ResidentHandler.Inst.GetFunction("CityLuaFunction.bindBabeMoodHUD").Action(hud);
        }
        
        public static void UnbindBabeMoodHUD(CityRealAiBabeMoodHUD hud)
        {
            ResidentHandler.Inst.GetFunction("CityLuaFunction.unbindBabeMoodHUD").Action(hud);
        }

        // 获取美女资源建筑的资源是否可领取
        public static bool IsBabeMoodResCanReceive(int roleId)
        {
            return ResidentHandler.Inst.GetFunction("CityLuaFunction.isBabeMoodResCanReceive").Func<int, bool>(roleId);
        }
        
        public static float BindStaffHUD(CityRealAiStaffHUD hud)
        {
            return ResidentHandler.Inst.GetFunction("CityLuaFunction.bindStaffHUD").Func<CityRealAiStaffHUD, float>(hud);
        }
        
        public static void UnbindStaffHUD(CityRealAiStaffHUD hud)
        {
            ResidentHandler.Inst.GetFunction("CityLuaFunction.unbindStaffHUD").Action(hud);
        }

        public static void AddCarnivalHotValue(string globalKey, Vector3 worldPos)
        {
            ResidentHandler.Inst.GetFunction("CityLuaFunction.addCarnivalHotValue").Action(globalKey, worldPos);
        }
        
        public static void MinusCarnivalHotValue(string globalKey, Vector3 worldPos)
        {
            ResidentHandler.Inst.GetFunction("CityLuaFunction.minusCarnivalHotValue").Action(globalKey, worldPos);
        }
        public static void LoadNewNpc(int cityRoleId)
        {
            ResidentHandler.Inst.GetFunction("CityLuaFunction.loadNewNpc").Action(cityRoleId);
        }
        
    }
}